package com.reshare.controller;

import com.reshare.base.BaseController;
import com.reshare.model.CommodityCountModel;
import com.reshare.service.StatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/*功能描述
 * @author ahm
 * statistics/toStatistics"
 */
@Controller
@RequestMapping("statistics")
public class StatisticsController extends BaseController {

    @Autowired
    private StatisticsService statisticsService;


    /*
     * 视图跳转
     */
    @RequestMapping("toStatistics")
    public ModelAndView toStatistics(){
        ModelAndView modelAndView = new ModelAndView();
        // 统计信息查询
        modelAndView.setViewName("statistics/statistics");
//商品状态（1，出售中；2，售罄；3，下架；4，该商品已删除，保留文本内容）

        return modelAndView;



    }



//    statistics/toAll

    @RequestMapping("toAll")
    public ModelAndView toAll(){
        ModelAndView modelAndView = new ModelAndView();
        CommodityCountModel result = statisticsService.toStatistic();
        modelAndView.setViewName("statistics/all");
        modelAndView.addObject("result",result);
        return modelAndView;
    }

}
